package com.atguigu.gmall.order.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.impl.OrderDegradeFeignClient;
import com.atguigu.gmall.order.model.OrderInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

@FeignClient(value = "service-order", fallback = OrderDegradeFeignClient.class, path = "/api/order")
public interface OrderFeignClient {

    /**
     * 汇总渲染订单确认页面所选的数据  TODO:Feign接口是新的Http请求,不需要携带参数类型HttpServletRequest
     *
     * @return
     */
    @GetMapping("/auth/trade")
    public Result<Map> orderTrade();



    /**
     * 根据订单ID查询订单信息 包含订单明细
     *
     * @param orderId
     * @return
     */
    @GetMapping("/inner/getOrderInfo/{orderId}")
    public OrderInfo getOrderInfoById(@PathVariable("orderId") Long orderId);


    /**
     * 提供给秒杀服务 保存秒杀订单接口
     * @param orderInfo
     * @return
     */
    @PostMapping("/inner/seckill/submitOrder")
    public Long submitSeckillOrder(@RequestBody OrderInfo orderInfo);
}
